// pages/getOrderNum/getOrderNum.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    shopImgs: [{
      url: '/imgSrc/icon0.png'
    },
    {
      url: '/imgSrc/icon2.png'
    },
    {
      url: '/imgSrc/icon3.png'
    },
      {
        url: '/imgSrc/icon4.png'
      },
      {
        url: '/imgSrc/icon5.png'
      },
      {
        url: '/imgSrc/icon6.png'
      },
      {
        url: '/imgSrc/icon7.png'
      },
      {
        url: '/imgSrc/icon8.png'
      },
      {
        url: '/imgSrc/icon9.png'
      }],
    statusImgs: [{
      url: '/imgSrc/busy.png'
    },
      {
        url: '/imgSrc/wait.png'
      },
      {
        url: '/imgSrc/leave.png'
      }],
    showMask: false,
    showNavigationMenu: false
  },
  //查看门店设施详情
  checkShopService:function(res){
    wx.navigateTo({
      url: '/pages/serviceList/serviceList',
    })
  },
  //购买剪发券
  buyTicket:function(res){
    wx.navigateTo({
      url: '/pages/buyTicket/buyTicket',
    })
  },
  //查看发型师详情
  showMasterInfo:function(res){
  wx.navigateTo({
    url: '/pages/masterInfo/masterInfo',
  })
  },
  //一键取号
  makeOrder:function(res){

    var that = this
    var animation = wx.createAnimation({
      duration: 800,
      timingFunction: 'ease-out'
    })
    that.animation = animation
    animation.translateY(-412).opacity(0.5).step()

    that.setData({
      maskAnim: animation.export(),
      showMask: true
    })
    setTimeout(function () {
      animation.translateY(0).opacity(1).step()
      that.setData({
        maskAnim: animation.export()
      })
    }, 200)

  },
  //取消取号弹窗动画
  cancelMask:function(res){

    var that = this
    var animation = wx.createAnimation({
      duration: 800,
      timingFunction: 'ease'
    })
    that.animation = animation
    animation.translateY(-412).opacity(0.5).step()

    that.setData({
      maskAnim: animation.export(),
    })
    setTimeout(function () {
      animation.translateY(0).opacity(1).step()
      that.setData({
        maskAnim: animation.export(),
        showMask: false
      })

    }, 500)
  },
  //确认取号
  getNumSuccess:function(res){
    wx.navigateTo({
      url: '/pages/getNumSuccess/getNumSuccess',
    })
  },
  //显示导航菜单
  navigationTo:function(res){
    var that = this
    var animation = wx.createAnimation({
      duration: 400,
      timingFunction: 'ease'
    })
    that.animation = animation
    animation.translateY(308).opacity(0.5).step()

    that.setData({
      navMenuAnim: animation.export(),
      showNavigationMenu: true
    })
    setTimeout(function () {
      animation.translateY(0).opacity(1).step()
      that.setData({
        navMenuAnim: animation.export()
      })
    }, 200)
  },
  //取消导航菜单
  navMenuCancel:function(res){
    var that = this
    var animation = wx.createAnimation({
      duration: 600,
      timingFunction: 'ease'
    })
    that.animation = animation
    animation.translateY(308).opacity(1).step()

    that.setData({
      navMenuAnim: animation.export(),
    })
    setTimeout(function () {
      animation.translateY(0).opacity(0.5).step()
      that.setData({
        navMenuAnim: animation.export(),
        showNavigationMenu: false
      })

    }, 500)
  },
  navToMap:function(e){
    wx.getLocation({
      type: 'gcj02', //返回可以用于wx.openLocation的经纬度
      success: function (res) {
        var latitude = res.latitude
        var longitude = res.longitude
        wx.openLocation({
          latitude: 20.00,
          longitude: 40.00,
          name: "我的位置",
          scale: 28
        })
      }
    })
  },
  
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
      //  默认不显示弹窗
      this.setData({
        showMask: false
      })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})